import React from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  TouchableHighlight,
  Image,
} from 'react-native';

import TImage from '../../components/TImage';
import SizeUtils from '../../common/SizeUtils';
import Constants from '../../common/Constants';
import Config from '../../config';
import CommonListPage from '../common/CommonListPage';
import CommonAvatarView from '../common/CommonAvatarView';
import ActivityRequestEntryListMAction from '../../actions/activity/ActivityRequestEntryListMAction';
import CommonStyles from '../../common/CommonStyles';

export default class ActivityUserListView extends CommonListPage {
  constructor(props) {
    super(props);

  }

  _getViewStyle() {
      return {paddingTop:Config.paddingTop,
        backgroundColor:"#ffffff"}
  	}
  _getListViewStyle() {
      return {
        width:SizeUtils.getWindowSize().width,
        paddingTop:0,
        height:(SizeUtils.getWindowSize().height - Config.paddingTop - SizeUtils.translateDesignHeightToCode(0)),
        backgroundColor:"#fff"};
   }

  _onRenderItem(data, index) {
    return (<View style={{flexDirection:"row", alignItems:"center",
              borderBottomWidth:SizeUtils.translateDesignNumToCode(3),
              height:SizeUtils.translateDesignHeightToCode(140),
              borderBottomColor:'#eeeeee',}}>
            <CommonAvatarView style={{marginLeft:20}} avatarUri={this._getImageSource(data)} size={100}/>
          <Text numberOfLines={1}
            style={[CommonStyles.primaryText, {marginTop:SizeUtils.translateDesignHeightToCode(5),
            marginBottom:SizeUtils.translateDesignHeightToCode(5),
            textAlign:'center',
            marginLeft:10,
            color:'#000',fontSize:SizeUtils.translateFontSizeToCode(30),}]}>
            {data.by_name}
          </Text>
      </View>);
  }
  _getImageSource(data) {
    if(data.avatar_url) {
      return {uri:data.avatar_url};
    }
    else {
      return {uri:""};
    }
  }
  _requestData(page, listView) {
  	 const {routeData} = this.props.pageData;
     new ActivityRequestEntryListMAction().call(listView,{activity_id:routeData.activity_id,page:page,page_size:10,sort_id:1});
  }
}
